<?php
/**
 * Created by PhpStorm.
 * User: 周国强
 * Date: 2016/4/29
 * Time: 16:04
 */

namespace Admin\Controller;
use Common\Controller\AdminbaseController;
/*
 * 路由
 * */
class RouteController extends AdminbaseController
{
    protected $route_model;

    function _initialize() {
        parent::_initialize();
        $this->route_model = M("Route");
    }

    function index(){
        $routes = $this->route_model->order('listorder asc')->select();
        $this->assign("routes",$routes);
        $this->display();
    }

    function insert(){
        if(IS_POST){
            if ($this->route_model->create()){
                if ($this->route_model->add()!==false) {
                    $this->success("添加成功！", U("index"));
                } else {
                    $this->error("添加失败！");
                }
            } else {
                $this->error($this->route_model->getError());
            }

        }
    }

}